package com.nf.xiaomi.web.controller;

import com.nf.mvc.mapping.RequestMapping;
import com.nf.mvc.support.ResponseVO;
import com.nf.mvc.view.JsonViewResult;
import com.nf.xiaomi.service.PayService;
import com.nf.xiaomi.service.impl.PayServiceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static com.nf.mvc.handler.HandlerHelper.json;

@RequestMapping("/ali")
public class PayController {
    PayService service = new PayServiceImpl();
    @RequestMapping("/payment")
    public JsonViewResult processPayment(HttpServletRequest request, HttpServletResponse response, Long account, Integer orderID, Integer state) throws Exception {
        String s = service.executePayment(request, response, account, orderID, state);
        return json(new ResponseVO(200, "ok", s));
    }
}
